﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using OrganizedIN.BAL.Common;

namespace OrganizedIN.UI.Videos
{
    public partial class redate_videos : System.Web.UI.Page
    {
        DataSet ds = new DataSet();
        string strUserName = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string id = Request.QueryString["id"];
                strUserName = Convert.ToString(Session["UserID"]);

                if (!IsPostBack)
                {
                    DataSet ds = new DataSet();
                    ds = Common.getVideoDate(strUserName, id);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        dgVideoDate.DataSource = ds.Tables[0];
                        dgVideoDate.DataBind();
                    }
                    else
                    {
                        gridwrapper.InnerHtml = "<h2>Sorry! No records found</h2>";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        protected void dgRating_EditCommand(object sender, DataGridCommandEventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(e.Item.Cells[0].Text);
                TextBox txtdate = (TextBox)e.Item.Cells[2].FindControl("simple_calendar");
                //BasicDatePicker calendar = (BasicDatePicker)e.Item.Cells[2].FindControl("calendar");
                string date = txtdate.Text;
                ds = Common.updateVideoDate(strUserName, id, date);
                Response.Redirect("myvideos.aspx");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
